using System;
using System.Collections.Generic;
using System.Text;
using DTO;
using DAL;

namespace BUS
{
    public class tbhinhanhBUS
    {
        public static void Insert(tbhinhanhDTO ha)
        {
            tbhinhanhDAL tbhinhanhDAL = new tbhinhanhDAL();
            tbhinhanhDAL.Insert(ha);
        }
        public static void Update(tbhinhanhDTO ha)
        {
            tbhinhanhDAL tbhinhanhDAL = new tbhinhanhDAL();
            tbhinhanhDAL.Update(ha);
        }
        public static void Delete(int iD)
        {
            tbhinhanhDAL tbhinhanhDAL = new tbhinhanhDAL();
            tbhinhanhDAL.Delete(iD);
        }
        public static tbhinhanhDTOColection GET(string Where, int PageIndex, int PageSize,
                                        string OrderBy, string OrderDirection,
                                        out int TotalRecords)
        {
            tbhinhanhDAL tbhinhanhDAL = new tbhinhanhDAL();
            return tbhinhanhDAL.GET(Where, PageIndex, PageSize,
                            OrderBy, OrderDirection, out TotalRecords);
        }
        public static tbhinhanhDTOColection GETAll()
        {
            int t = 0;
            tbhinhanhDAL tbhinhanhDAL = new tbhinhanhDAL();
            return tbhinhanhDAL.GET("where 1=1", 0, 10, tbhinhanhDTOColumn.Mahinhanh.ToString(), "ASC", out t);
        }
        public static tbhinhanhDTOColection getid(int id)
        {
             int t = 0;
           tbhinhanhDAL tbhinhanhDAL = new tbhinhanhDAL();
           //tbhinhanhDTOColection hacolect = tbhinhanhDAL.GET("where " + tbhinhanhDTOColumn.Masp.ToString() + " = " + id.ToString(), 0, 0,
           //    tbhinhanhDTOColumn.Tenhinhanh.ToString(), "ASC", out t);
           //if (hacolect.Count >= 1)
           //    return hacolect[0];
           //return null;
           return tbhinhanhDAL.GET("where " + tbhinhanhDTOColumn.Masp.ToString() + " = " + id.ToString(), 0, 0,
           tbhinhanhDTOColumn.Tenhinhanh.ToString(), "ASC", out t);
        }

        public static tbhinhanhDTOColection gethinh(int id)
        {
            int t = 0;
            tbhinhanhDAL tbhinhanhDAL = new tbhinhanhDAL();
            //tbhinhanhDTOColection hacolect = tbhinhanhDAL.GET("where " + tbhinhanhDTOColumn.Masp.ToString() + " = " + id.ToString(), 0, 0,
            //    tbhinhanhDTOColumn.Tenhinhanh.ToString(), "ASC", out t);
            //if (hacolect.Count >= 1)
            //    return hacolect[0];
            //return null;
            return tbhinhanhDAL.GET("where " + tbhinhanhDTOColumn.Masp.ToString() + " = " + id.ToString(), 0, 0,
            tbhinhanhDTOColumn.Tenhinhanh.ToString(), "ASC", out t);
        }
    }
}
